package com.tools.scanner.ui.qrcode.creator.impl

import android.os.Bundle
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.tools.scanner.R
import com.tools.scanner.databinding.FragmentEmailInputBinding
import com.tools.scanner.utils.ToastUtil

class CreateEmailFragment : BaseCreateFragment() {

    private lateinit var mBinding: FragmentEmailInputBinding

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        mBinding = FragmentEmailInputBinding.inflate(layoutInflater)
        return mBinding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
    }

    override fun checkParams(): Boolean {
        if (TextUtils.isEmpty(mBinding.etEmail.text.toString())) {
            ToastUtil.showToast(R.string.input_type_check_email)
            return false
        }
        return true
    }

    override fun createQrCodeContent(): String {
        return "MATMSG:TO:${mBinding.etEmail.text};SUB:${mBinding.etSubject.text};BODY:${mBinding.etBody.text};"
    }
}